package com.gx.smart.building.ui.photo.model;

import android.graphics.Rect;
import android.os.Parcel;
import android.os.Parcelable;

import androidx.annotation.Nullable;

import com.previewlibrary.enitity.IThumbViewInfo;

/**
 * @author xiaosy
 * @create 2020/7/29
 * @Describe
 **/
public class ImageViewInfo implements IThumbViewInfo {
    public static final Parcelable.Creator<ImageViewInfo> CREATOR = new Parcelable.Creator<ImageViewInfo>() {
        @Override
        public ImageViewInfo createFromParcel(Parcel source) {
            return new ImageViewInfo(source);
        }

        @Override
        public ImageViewInfo[] newArray(int size) {
            return new ImageViewInfo[size];
        }
    };
    private String url;  //图片地址
    private Rect mBounds; // 记录坐标

    public ImageViewInfo(String url) {
        this.url = url;
    }


    protected ImageViewInfo(Parcel in) {
        this.url = in.readString();
        this.mBounds = in.readParcelable(Rect.class.getClassLoader());
    }

    @Override
    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    @Nullable
    @Override
    public String getVideoUrl() {
        return null;
    }

    public Rect getBounds() {
        return mBounds;
    }

    public void setBounds(Rect mBounds) {
        this.mBounds = mBounds;
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(this.url);
        dest.writeParcelable(this.mBounds, flags);
    }
}
